<varset> : Assign Variable Value

Declares variable and sets its value.

Syntax: 

<varset>("Variable", "MessageTitle")

Variable
Defines variable and its value in the form VARIABLE_NAME=VALUE.  Variable can be any string (different from system variablesID_SYSTEMVARIABLES).  The value can be either constant string or other variable or empty string.  There are four basic behaviors of the command:
1. VALUE is supplied.  In such case the variable is assigned the VALUE.  For example, "vNumber=10" or "vName=John".
2.
List of possible values is  supplied in VALUE.  Each single item in the list is separated by "|" character.  For example, "vNames=Jane|Paul|Chris|Michae".
3. VALUE is an empty string ("vName=").  In such the case, a dialog window with the
MessageTitle appears and prompts user to enter the variable value.  Note:  To assign an empty string to the variable use this construction: "vEmptyStr=_vStrEmpty".
4. VALUE is equal to "YES/NO".  In such the case, a "yes/no" message box withMessageTitle appears.  If user selects "yes" button the "YES" value is assigned to the variable.  If the user selects "no" button the "NO" value is assigned.  For example, "vDoYouWant=YES/NO".  

 

In cases #2 and #3 above, if user clicks "Cancel" button the _vCanceled system variable is set to 1 (otherwise it is 0) to allow macro designer to distinguish between situations when OK or Cancel button was clicked.

Instead of using VARIABLE_NAME=VALUE syntax, also VARIABLE_NAME=!VALUE can be used.  In this case, the VALUE is assigned to the variable and the rules #2 - #4 above are not applied (hard assignement).

MessageTitle 
A title of the window that appears in cases 1 and 3 above.

Example: 

<#> This macro demonstrates <varset> command
<#>
<cmds>

<varset>("vName=","Insert Your Name")
<if_str>("_vCanceled==1") <exitmacro> <endif>

<varset>("vShow=YES/NO","Do you want to see your name ?")

<if_str>("vShow==YES")
   <msg>(100,100,"vName","Your name is:",1)

<endif>

<varset>("vName=Jane|Paul|Michael|Chris","Who is my best friend ?")
<if_str>("_vCanceled==1") <exitmacro> <endif>

<if_str>("vName==Jane")
   <msg>(100,100,"Yes!","Message",1)
<else>
   <msg>(100,100,"No!","Message",1)
<endif>